package Rewriting;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.HashSet;
import java.util.Set;




public final class VariableNameGenerator {
  private SecureRandom random = new SecureRandom();
  private Set<String> instantiatedStrings ;
  private static VariableNameGenerator instance;
  
  public static VariableNameGenerator getInstance() {
      if (instance == null)
          instance = new VariableNameGenerator();
      return instance;
      
  }
  private VariableNameGenerator () {
      this.instantiatedStrings = new HashSet<String> ();
      
  }

  public String newVariable() {
      String nextId = null;
      
    nextId = new BigInteger(15, random).toString(32);
    while (this.instantiatedStrings.contains(nextId))
        nextId = new BigInteger(15, random).toString(32);
    return nextId;
  }
  
  
  
  
}